package com.neuedu.yyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.neuedu.yyzx.entity.Checkin;
import com.neuedu.yyzx.entity.Customer;
import com.neuedu.yyzx.mapper.CustomerMapper;
import com.neuedu.yyzx.service.ICustomerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 客户信息  服务实现类
 * </p>
 *
 * @author dya
 * @since 2021-04-27
 */
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {


    public boolean updateAll(Customer customer) {
        UpdateWrapper updateWrapper = new UpdateWrapper();
        updateWrapper.set("customer_name", customer.getCustomerName());
        updateWrapper.set("customer_gender", customer.getCustomerGender());
        updateWrapper.set("customer_age", customer.getCustomerAge());
        updateWrapper.set("id_number", customer.getIdNumber());
        updateWrapper.set("record_id", customer.getRecordId());
        updateWrapper.set("assess_doctor", customer.getAssessDoctor());
        updateWrapper.set("resp_doctor", customer.getRespDoctor());
        updateWrapper.set("health_person", customer.getHealthPerson());
        updateWrapper.set("house", customer.getHouse());
        updateWrapper.set("bed_id", customer.getBedId());
        updateWrapper.set("checkin_date", customer.getCheckinDate());
        updateWrapper.set("end_date", customer.getEndDate());
        updateWrapper.set("body_info", customer.getBodyInfo());
        updateWrapper.set("nurse_level_name", customer.getNurseLevelName());
        updateWrapper.set("urgent_contact", customer.getUrgentContact());
        updateWrapper.set("contact_telephone", customer.getContactTelephone());
        updateWrapper.set("results", customer.getResults());

        updateWrapper.eq("customer_id", customer.getCustomerId());

        int success = getBaseMapper().update(customer, updateWrapper);

        return success>0;
    }
}
